package com.qf.dao;

import com.qf.pojo.Item;
import com.qf.pojo.Subitem;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @Description: 公用常量
 * @Data: 2022/8/25 14:54
 * @Pacakge: com.qf.dao
 * @ClassName: SubitemDao
 * @Author: fan
 * 分项工程数据库访问
 */
public interface SubitemDao {
    /**
     * 查询所有的分项工程
     * @return 分项工程列表
     */
    @Results(id = "findSubItemMap",value = {
            @Result(column = "suid",property = "suid"),
            @Result(column = "sname",property = "sname"),
            @Result(column = "starttime",property = "starttime"),
            @Result(column = "endtime",property = "endtime"),
            @Result(column = "updatetime",property = "updatetime"),
            @Result(column = "status",property = "status"),
            @Result(column = "suid",property = "items",
                    many = @Many(select = "com.qf.dao.ItemDao.findItemBySuid",
                    fetchType = FetchType.EAGER)
            )
    })
    @Select("select * from subitem where status =1")
    List<Subitem> findSubitem();
}
